/*package com.nuanshui.heatedloan.config;

import java.util.Map;

import javax.servlet.Filter;

import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.session.mgt.SessionManager;
import org.apache.shiro.spring.LifecycleBeanPostProcessor;
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
import org.apache.shiro.web.mgt.DefaultWebSecurityManager;
import org.apache.shiro.web.session.mgt.DefaultWebSessionManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.google.common.collect.Maps;
import com.nuanshui.heatedloan.extension.shiro.CaptchaFormAuthenticationFilter;
import com.nuanshui.heatedloan.extension.shiro.ShiroDbRealm;
import com.nuanshui.heatedloan.service.cms.security.AdminUserService;
import com.nuanshui.heatedloan.service.cms.security.UserRoleService;

@Configuration
public class ShiroConfig {
	
	@Bean
	public LifecycleBeanPostProcessor lifecycleBeanPostProcessor(){
		LifecycleBeanPostProcessor LifecycleBeanPostProcessor = new LifecycleBeanPostProcessor();
		return LifecycleBeanPostProcessor;
	}
	
	@Bean
	public CaptchaFormAuthenticationFilter captchaFormAuthenticationFilter(){
		CaptchaFormAuthenticationFilter captchaFormAuthenticationFilter = new CaptchaFormAuthenticationFilter();
		return captchaFormAuthenticationFilter;
	}
	
	*//**
	 * 会话管理器，设定会话超时及保存
	 * @author Gonzo
	 * @date 2016年12月30日上午11:18:19
	 * @return
	 * @since 1.0.0
	 *//*
	@Bean
	public SessionManager sessionManager(){
		DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
		sessionManager.setGlobalSessionTimeout(1800000L);//全局会话超时时间（单位毫秒），默认30分钟 
		return sessionManager; 
	}
	
	
	@Bean
	public ShiroDbRealm shiroDbRealm(AdminUserService userService, UserRoleService userRoleService){
		ShiroDbRealm shiroDbRealm = new ShiroDbRealm();
		shiroDbRealm.setUserService(userService);
		shiroDbRealm.setUserRoleService(userRoleService);
		return shiroDbRealm;
	}
	
	*//**
	 * @author Gonzo
	 *  Shiro's main business-tier object for web-enabled applications 
	 * @date 2016年12月30日上午11:20:39
	 * @param realm
	 * @param sessionManager
	 * @return
	 * @since 1.0.0
	 *//*
	@Bean
	public SecurityManager securityManager(ShiroDbRealm realm, SessionManager sessionManager){
		DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
		securityManager.setRealm(realm);
		securityManager.setSessionManager(sessionManager);
		return securityManager;
	}
	
	
	
	*//**
	 * Shiro Filter
	 * @author Gonzo
	 * @date 2016年12月30日上午10:50:56
	 * @return
	 * @since 1.0.0
	 *//*
	@Bean
	public ShiroFilterFactoryBean shiroFilter(SecurityManager securityManager, CaptchaFormAuthenticationFilter captchaFormAuthenticationFilter){
		
		ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean();
		
		shiroFilterFactoryBean.setSecurityManager(securityManager);
		shiroFilterFactoryBean.setLoginUrl("cms/manage/login");
		shiroFilterFactoryBean.setSuccessUrl("/cms/manage/index");
		Map<String, Filter> filters = Maps.newHashMap();
		filters.put("authc", captchaFormAuthenticationFilter);
		shiroFilterFactoryBean.setFilters(filters);
		
		shiroFilterFactoryBean.setFilterChainDefinitions(
				"/Captcha.jpg = anon\n" +
				"/static/** = anon\n" +
				"/Captcha.jpg = anon\n" +
				"/api/Captcha.jpg = anon\n" +
				"/cms/manage/login/timeout = anon\n" +
				"/cms/manage/login = authc\n" +
				"/cms/manage/logout = logout\n" +
		    	"/cms/manage/** = user\n" +
		    	"/user/** = user\n" +
		    	"/role/** = user\n" +
		    	"/module/** = user\n" );
		
		return shiroFilterFactoryBean;
	}
	
}
*/